from selenium.webdriver.common.by import By


class UserContactsListLocator:
    """ contacts list页面元素 """

    # 页面title
    contacts_list_title = (By.XPATH, "//span[contains(@class,'cre-page-container-header-panel-title')]")

    # 页面顶部back按钮
    contacts_list_back = (By.CSS_SELECTOR, "div.cre-page-container-header-panel-left svg")

    # 查询条件输入框
    select_keyword_input = (By.CSS_SELECTOR, "input[placeholder = 'Search by Email']")

    # 触发查询按钮
    select_icon = (By.CSS_SELECTOR, "button.antd4-input-search-button")

    # 列表第一行的email列的值
    col_email_value = (By.CSS_SELECTOR, "tr.antd4-table-row>td.antd4-table-cell:first-child+td>div")

    # 空列表No Data提示
    contacts_list_empty = (By.XPATH, "//div[(text()='No Data')]")

    # 查询中加载演示
    contacts_list_loading = (By.CSS_SELECTOR, "div[aria-busy='true']")

    # 列表delete按钮
    contacts_list_delete = (By.XPATH, "//span[(text()='Delete')]/parent::*")

    # 删除成功提示
    contact_list_delete_success = (By.XPATH, "//span[(text()='Deleted successfully.')]")

    # 删除二次确认按钮
    delete_contact_confirm_button = (By.CSS_SELECTOR, "button.antd4-btn-dangerous")

    # 列表edit按钮
    contacts_list_edit = (By.XPATH, "//span[(text()='Edit')]/parent::*")

    # 编辑成功提示
    edit_success_tip = (By.XPATH,  "//span[(text()='Edited successfully.')]")

    # 编辑弹窗接受发票开关
    edit_contact_layer_switch = (By.CSS_SELECTOR, "button#receiveInvoiceFlag")



    # 新增Contact按钮
    add_contact_button = (By.XPATH, "//span[(text()='New Contact')]/parent::*")

    # 新增Contact弹层标题
    add_contact_layer_title = (By.CSS_SELECTOR, "div#rc_unique_2")

    # 新增Contact弹层名字输入框
    add_contact_layer_name_input = (By.CSS_SELECTOR, "input[placeholder='Enter name']")

    # 新增Contact弹层邮箱输入框
    add_contact_layer_email_input = (By.CSS_SELECTOR, "input[placeholder='Enter email address']")

    # 邮箱格式错误提示
    add_contact_layer_email_form_alert = (By.XPATH, "//div[(text()='Please input the correct email address.')]")

    # 新增Contact弹层验证码输入框
    add_contact_layer_code_input = (By.CSS_SELECTOR, "input[placeholder='Enter the code you received on your email']")

    # 验证码send按钮
    add_contact_layer_send_code = (By.CSS_SELECTOR, "div.verification___1bUaV button")

    # 点击验证码send按钮后的loading图标
    add_contact_layer_send_code_loading = (By.CSS_SELECTOR, "div.verification___1bUaV button svg")

    # 验证码缺失提示
    add_contact_layer_code_empty_alert = (By.XPATH, "//div[(text()='Please enter email verification code.')]")

    # alert气泡提示
    add_contact_layer_pup_alert = (By.CSS_SELECTOR, "div.ant-message-warning span")

    # 新增Contact弹层接受发票开关
    add_contact_layer_switch = (By.CSS_SELECTOR, "button[role='switch']")

    # 新增Contact弹层确认按钮
    add_contact_layer_confirm_button = (By.XPATH, "//span[(text()='OK')]/parent::*")

    # ================================================产品相关元素==========================================================

    # 展开产品抽屉
    product_drawer = (By.XPATH, "//div[@class='product-menu-tigger']")

    # Redis产品页元素
    # 创建实例按钮
    redis_create_instance = (By.XPATH, "//span[text()='Create Instance']/..")
    # Billing Method行选项
    redis_billing_method_options = (By.XPATH, "//label[@title='Billing Method']/../..//div[@class='antd4-space-item']")
    # Region行选项
    redis_region_options = (By.XPATH, "(//label[@title])[2]/../..//div[@class='antd4-space-item']")
    # Organization选项
    organization_options = (By.XPATH, "//label[@title='Organization']/../../div[2]//div[@class='antd4-select-selector']")
    # Zone行选项
    zone_option = (By.XPATH, "//label[@title='Zone']/../../div[2]//span[not(@class)]")
    # Edition行选项
    edition_options = (By.XPATH, "//label[@title='Edition']/../../div[2]//div[@class='antd4-space-item']")
    # Version行选项
    version_options = (By.XPATH, "//label[@title='Version']/../../div[2]//div[@class='antd4-space-item']")
    # Architecture Type行选项
    architecture_type_options = (By.XPATH, "//label[@title='Architecture Type']/../../div[2]//div[@class='antd4-space-item']")
    # Shard Number默认选项
    shard_number_option = (By.XPATH, "//label[@title='Shard Number']/../..//div[@class='antd4-select-selector']")
    # Shard Number选项集合
    shard_number_options = (By.XPATH, "//label[@title='Shard Number']/../..//div[@class='rc-virtual-list-holder-inner']/div")
    # shard number selector
    shard_number_selector = (By.XPATH, "//label[@title='Shard Number']/../..//div[@class='antd4-select-selector']")
    # Node Type选项
    node_type_options = (By.XPATH, "//label[@title='Node Type']/../../div[2]//div[@class='antd4-space-item']")
    # Instance Name输输入框
    instance_name_input = (By.XPATH, "//label[@title='Instance Name']/../../div[2]//input")
    # instance name alert
    instance_name_alert = (By.XPATH, "//label[@title='Instance Name']/../..//div[@role='alert']")
    # buy now button
    buy_now_button = (By.XPATH, "//div[@class='cre-container-footer-primary']/button")
    # instance type selector
    instance_type_selector = (By.XPATH, "//label[@title='Instance Type']/../..//div[@class='antd4-select-selector']")
    # instance type options
    instance_type_options = (By.XPATH, "//label[@title='Instance Type']/../..//div[@class='rc-virtual-list-holder-inner']/div")
    # network type options
    network_type_options = (By.XPATH, "//label[@title='Network Type']/../../div[2]//div[@id='creForm_networkType']")
    # ip address whitelist input
    ip_address_whitelist_input = (By.XPATH, "//label[@title='IP Address Whitelist']/../../div[2]//input")
    # ip address whitelist alert
    ip_address_whitelist_alert = (By.XPATH, "//label[@title='IP Address Whitelist']/../..//div[@role='alert']")
    # connection password input
    connection_password_input = (By.XPATH, "//label[@title='Connection Password']/../../div[2]//input")
    # connection password alert
    connection_password_alert = (By.XPATH, "//label[@title='Connection Password']/../..//div[@role='alert']")
    # high authority account input
    high_authority_account_input = (By.XPATH, "//label[@title='High Authority Account']/../../div[2]//input")
    # high authority account alert
    high_authority_account_alert = (By.XPATH, "//label[@title='High Authority Account']/../..//div[@role='alert']")
    # password input
    password_input = (By.XPATH, "//label[@title='Password']/../../div[2]//input")
    # password alert
    password_alert = (By.XPATH, "//label[@title='Password']/../..//div[@role='alert']")
    # confirm password input
    confirm_password_input = (By.XPATH, "//label[@title='Confirm Password']/../../div[2]//input")
    # confirm password alert
    confirm_password_alert = (By.XPATH, "//label[@title='Confirm Password']/../..//div[@role='alert']")
    # order setting title
    order_setting_title = (By.XPATH, "//div[contains(@class, 'base-card-title') and text()='Order Setting']")
    # validity period options
    validity_period_options = (By.XPATH, "//label[@title='Validity Period']/../../div[2]//div[@class='antd4-space-item']")
    # price style items
    price_style_items = (By.XPATH, "//span[contains(@class, 'orderCostsMoney')]/span")
    # redis console table columns
    redis_console_table_columns = (By.XPATH, "//thead//th")

    # ================================================EIP==========================================================
    # my resource tab
    my_resource_tab = (By.CSS_SELECTOR, "[path='/work_bench/myResource']")
    # create new button
    my_resource_create_new_button = (By.XPATH, "//span[text()='Create New ']/..")
    # create eip
    my_resource_create_eip_button = (By.XPATH, "//div[contains(@class, 'createMenu')]//div[text()='Elastic IP Addresses']")
    # create eip items
    eip_purchase_item = (By.XPATH, "//div[contains(@class, 'antd4-row')]//label[@title]")
    # billing method pay-as-you-go
    billing_method_payg_button = (By.XPATH, "//span[text()='Pay-As-You-Go']/../../..")
    # eip console create button
    eip_console_create_button = (By.XPATH, "//span[text()='Create EIP']/../..")
    # eip console_release_button
    eip_console_release_button = (By.XPATH, "(//span[text()='Release'])[1]/..")
    # eip binding_resource_button
    eip_binding_resource_button = (By.XPATH, "//span[text()='Binding resource']/..")
    # iframe
    iframe_resource_orchestration_service = (By.CSS_SELECTOR, '[id="hj_container"]')
    # layer button
    layer_button = (By.XPATH, "//div[@role='alertdialog']//button")
    # layer title
    layer_title = (By.XPATH, "//div[text()='Associate EIP with Resource']")
    # layer instance type selector
    layer_instance_type_selector = (By.XPATH, "//label[text()='Instance type']/../../div[2]//span[@class='next-input next-medium next-select-inner']")
    # layer instance type selector options
    layer_instance_type_selector_option = (By.XPATH, "//div[@class='next-overlay-wrapper opened']//li")
    # console page title
    console_page_title = (By.XPATH, "//div[@class='teamix-nav-sidebar-header']")
    # EIP_item
    eip_item = (By.XPATH, "//span[text()='Elastic IP Addresses']/../..")
    # eip create page title
    eip_create_page_title = (By.XPATH, "//div[@class='product-name']")

    # eip console table columns
    eip_console_table_columns = (By.XPATH, "//th[not(contains(@class, 'next-table-selection'))]")
    # eip pay card title
    eip_pay_card_title = (By.XPATH, "//div[contains(@class, 'titlePanelLeft')]")

    # eip pay detail
    eip_pay_detail = (By.XPATH, "//div[contains(@class, 'detail_')]")
    # eip pay detail item
    eip_pay_detail_item = (By.XPATH, "//div[contains(@class, 'helpItemLabel_')]")







